package main

import (
	"fmt"
	"stack"
)

type Stu struct {
	Name string
	Age  int
}

func (s *Stu) String() string {
	return fmt.Sprintf("{name=%s, age=%d}", s.Name, s.Age)
}

func main() {
	fmt.Println("-----------------Stack-----------------")
	arr := [...]*Stu{{"zs", 18}, {"ls", 19}}
	s := stack.New()
	for _, v := range arr {
		s.Push(v)
		fmt.Println(s)
	}
	fmt.Println("stack:", s.Empty(), s.Size())

	for i := 0; i < len(arr); i++ {
		a := s.Pop()
		fmt.Println("pop:", a)
		fmt.Println(s)
	}

	fmt.Println("stack:", s.Empty(), s.Size())
	s.Clear()
}
